package com.lht.testDemo;

/**
 * @author Eric
 * @version 1.0
 * @date 2019-12-11
 */
public class ThreadLocalTest {

    private static ThreadLocal<Double> test = new ThreadLocal<>();


    public static void main(String[] args) {
        a();
        System.gc();
        System.out.println("mian:" + b());
        Thread thread = new Thread(new Runnable() {

            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName() + ":" + b());
            }
        });
        thread.start();
    }


    public static void a() {
        test.set(1.0);
    }

    public static Double b() {
        return test.get();
    }
}
